﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProductInStockAdd.aspx.cs"
    Inherits="BySoft.Web.Site.OutSource.ProductInStockAdd" MasterPageFile="~/MastePage/SubEmptyMaster.Master" %>

<%@ MasterType VirtualPath="~/MastePage/SubEmptyMaster.Master" %>
<%@ Register Assembly="OneSoft.Web" Namespace="OneSoft.Web.UI.WebControls" TagPrefix="asp" %>
<%@ Register Src="../UserControl/SuggestTextBox2.ascx" TagName="SuggestTextBox2"
    TagPrefix="uc1" %>
<%@ Register Assembly="BySoft.Web.Controls" Namespace="BySoft.Web.Controls" TagPrefix="cc1" %>
<asp:Content ID="cphHeadContent" runat="server" ContentPlaceHolderID="EmptyMasteCPH">
    <script language="javascript" type="text/javascript">
        //$(function () {
        //    iframeAutoFit();
        //});





        function OpenProductID() {
            var currentID = document.getElementById("<%=lblBillID.ClientID%>").value;

            ShowTopDialog('产品选择', '../ComPage/QuerySProductByInStock.aspx?id='+currentID, 'FillProductID();', 1000, 600); return false;
        }
        //回调
        function FillProductID() {

            var str = getCookie(dialogReturn_key);

            if (str != null && str != "") {
                str = decodeURIComponent(str);

                var arrTmp = str.split(",");

                if (undefined != arrTmp[0]) {
                    document.getElementById("<%=hidProductID.ClientID%>").value = arrTmp[0];
                    document.getElementById("<%=txtProductID.ClientID%>").value = arrTmp[0];

                }
                if (undefined != arrTmp[1]) {
                    document.getElementById("<%=txtProductName.ClientID%>").value = arrTmp[1];
                }
                if (undefined != arrTmp[2]) {
                    document.getElementById("<%=txtSpecifications.ClientID%>").value = arrTmp[2];
                }

                if (undefined != arrTmp[3]) {
                    document.getElementById("<%=txtCustomerPartNo.ClientID%>").value = arrTmp[3];
                }

                if (undefined != arrTmp[4]) {
                    document.getElementById("<%=txtOutSide.ClientID%>").value = arrTmp[4];
                }
                if (undefined != arrTmp[5]) {
                    document.getElementById("<%=txtInSide.ClientID%>").value = arrTmp[5];
                }
                if (undefined != arrTmp[6]) {
                    document.getElementById("<%=txtUnit.ClientID%>").value = arrTmp[6];
                }
                if (undefined != arrTmp[7]) {
                    document.getElementById("<%=txtLastNum.ClientID%>").value = arrTmp[7];
                    document.getElementById("<%=txtNums.ClientID%>").value = arrTmp[7];
                }
                if (undefined != arrTmp[8]) {
                    document.getElementById("<%=txtWorkOrderNo.ClientID%>").value = arrTmp[8];
                   document.getElementById("<%=hidWorkOrderNo.ClientID%>").value = arrTmp[8];

               }
               if (undefined != arrTmp[9]) {
                   document.getElementById("<%=txtScheduleID.ClientID%>").value = arrTmp[9];
                  document.getElementById("<%=hidScheduleID.ClientID%>").value = arrTmp[9];

              }
              $("#<%=btnSelectProduct.ClientID %>").click();

            }
            setCookie(dialogReturn_key, "");

        }


        function ChangePriceAmount(obj) {

            var strBase = "txtPrice";
            var pre = obj.id.replace(strBase, "");

            var dtxtNum = $("#" + pre + "txtNums").val() * 1;                    //输入的数量
            var dtxtPrice = $("#" + pre + "txtPrice").val() * 1;                 //输入的价格

            var dAmount = 0;
            dAmount = dtxtPrice * dtxtNum;//金额 = 数量*单价


            // $("#" + pre + "txtPrice").val(dtxtPrice.toFixed(2));
            $("#" + pre + "txtAmount").val(dAmount.toFixed(2));

        }

    </script>

    <h1 class="tit">成品库存 >> <a href="ProductInStockList.aspx">成品入库单</a> >> 新增</h1>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div class="tableStyle2">
                <table cellpadding="0" cellspacing="0" id="tBase" runat="server">
                    <tr>
                        <th class="left2">表单号码：
                        </th>
                        <td class="right2">
                            <asp:Label CssClass="lblreadonly" ID="lblBillID" runat="server"></asp:Label>
                        </td>
                        <th class="left2">日期：
                        </th>
                        <td class="right2">
                            <asp:Label CssClass="lblreadonly" ID="lblBillDate" runat="server"></asp:Label>
                        </td>
                    </tr>

                    <tr>


                        <th width="20%">产品编号：
                        </th>
                        <td width="30%">

                            <asp:HiddenField ID="hidScheduleID" runat="server" />
                            <asp:HiddenField ID="hidWorkOrderNo" runat="server" />
                            <asp:HiddenField ID="hidProductID" runat="server" />
                            <asp:TextBox ID="txtProductID" runat="server" MaxLength="50" ReadOnly="true" CssClass="text ui-widget-content ui-corner-all"
                                Width="90%"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="rfvProductID" runat="server" ErrorMessage="请选择产品！"
                                ControlToValidate="txtProductID" Display="None" ValidationGroup="gSubmit">
                            </asp:RequiredFieldValidator>
                            <span style="color: Red">*</span>
                            <a href="#" onclick="OpenProductID()">
                                <img src="../App_Themes/Common_CSS/images/GridDetail.gif" alt="" /></a>

                            <asp:Button ID="btnSelectProduct" runat="server" CssClass="Hidden" OnClick="btnSelectProduct_Click" />

                        </td>
                        <th>客户零件号
                        </th>
                        <td>
                            <asp:TextBox ID="txtCustomerPartNo"  runat="server" MaxLength="50" ReadOnly="true" CssClass="text ui-widget-content ui-corner-all"
                                Width="90%"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <th>产品名称</th>
                        <td>
                            <asp:TextBox ID="txtProductName"  runat="server" MaxLength="50" ReadOnly="true" CssClass="text ui-widget-content ui-corner-all"
                                Width="90%"></asp:TextBox>
                        </td>
                        <th>规格
                        </th>
                        <td>
                            <asp:TextBox ID="txtSpecifications" runat="server" MaxLength="50" ReadOnly="true" CssClass="text ui-widget-content ui-corner-all"
                                Width="90%"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>

                        <th>外径
                        </th>
                        <td>
                            <asp:TextBox ID="txtOutSide" runat="server" MaxLength="50" ReadOnly="true" CssClass="text ui-widget-content ui-corner-all"
                                Width="90%"></asp:TextBox>
                        </td>
                        <th>内径
                        </th>
                        <td>
                            <asp:TextBox ID="txtInSide" runat="server" MaxLength="50" ReadOnly="true" CssClass="text ui-widget-content ui-corner-all"
                                Width="90%"></asp:TextBox>
                        </td>
                    </tr>

                    <tr>

                        <th>单位
                        </th>
                        <td>
                            <asp:TextBox ID="txtUnit" runat="server" MaxLength="50" ReadOnly="true" CssClass="text ui-widget-content ui-corner-all"
                                Width="90%"></asp:TextBox>
                        </td>
                        <th></th>
                        <td></td>
                    </tr>
                    <tr>

                        <th>排程号码
                        </th>
                        <td>
                            <asp:TextBox ID="txtScheduleID" runat="server" MaxLength="50" ReadOnly="true" CssClass="text ui-widget-content ui-corner-all"
                                Width="90%"></asp:TextBox>
                        </td>
                        <th>制造号码</th>
                        <td>
                            <asp:TextBox ID="txtWorkOrderNo" runat="server" MaxLength="50" ReadOnly="true" CssClass="text ui-widget-content ui-corner-all"
                                Width="90%"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <th>未入库数量
                        </th>
                        <td>
                            <asp:TextBox ID="txtLastNum" runat="server" MaxLength="50" ReadOnly="true" CssClass="text ui-widget-content ui-corner-all"
                                Width="90%"></asp:TextBox>

                        </td>

                        <th>数量
                        </th>
                        <td>
                            <asp:TextBox ID="txtNums" runat="server" MaxLength="50" CssClass="text ui-widget-content ui-corner-all"
                                Width="90%"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="rfvNums" runat="server" ErrorMessage="请填写入库数量！"
                                ControlToValidate="txtNums" Display="None" ValidationGroup="gSubmit" />
                            <asp:RegularExpressionValidator ControlToValidate="txtNums" Display="None" ErrorMessage="入库数量，请填写数字" ID="revOutSide"
                                ValidationExpression="\d{0,9}(\.\d{0,2})?" ValidationGroup="gSubmit" runat="server" />


                        </td>

                    </tr>
                </table>
            </div>

            <div class="controlBar" align="center">
                <table cellpadding="0" cellspacing="0" style="width: 300px; margin: 0 auto;">
                    <tr>
                        <td colspan="4">
                            <label class="btnStyleb png_bg">
                                <asp:Button ID="btnSubmit" runat="server" Text="确定"
                                    OnClick="btnSubmit_Click" ValidationGroup="gSubmit" />
                            </label>
                            <label class="btnStylec png_bg">
                                <input type="button" id="Button2" value="返回" runat="server" onclick="window.location = 'ProductInStockList.aspx'" />
                            </label>
                        </td>
                    </tr>
                </table>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>




</asp:Content>


